FROM ubuntu:16.04

LABEL maintainer="chenwenlong <chenwenlong@epweike.com>"

RUN set -ex && \
    apt-get update && \
    apt-get install -y --no-install-recommends wget openjdk-8-jre-headless python && \
    cd /tmp && \
    wget -O datax.tar.gz http://datax-opensource.oss-cn-hangzhou.aliyuncs.com/datax.tar.gz && \
    apt-get purge -y wget && \
    apt-get autoremove -y && \
    rm -rf /var/lib/apt/lists/* && \
    tar -zxf datax.tar.gz && \
    mv datax /opt/ && \
    rm -f datax.tar.gz

# Timezone
ENV TZ=Asia/Shanghai
RUN sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list \
          && apt-get update \
          && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
          && apt-get install tzdata \
          && apt-get clean \
          && apt-get autoclean \
          && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
          && dpkg-reconfigure -f noninteractive tzdata

# crontab
RUN apt-get update && apt-get install -y --no-install-recommends cron vim \
    && rm -rf /var/lib/apt/lists/* \
    && apt-get clean

COPY docker-entrypoint.sh /root/docker-entrypoint.sh

RUN mkdir /var/log/cron && \
    chmod a+x /root/docker-entrypoint.sh

WORKDIR /var/log/cron

ENTRYPOINT ["/root/docker-entrypoint.sh"]
